﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using System;
using NJamb.Parser.Subjects.Void;
using NJamb.Specifications.Delta;
using NJamb.Specifications.Void;
using Stile.Patterns.SelfDescribingPredicates;
#endregion

namespace NJamb.Parser.SpecificationBuilders.Delta.Void
{
    public class VoidDeltaSpecificationBuilder<THost> :
        DeltaSpecificationBuilder
            <THost, IVoidCollaboratingSubject<THost>, IEvaluation, IVoidCollaboratingSpecification<THost>, IDeltaSpecification>,
        IVoidDeltaSpecificationBuilder<THost>
        where THost : class
    {
        public VoidDeltaSpecificationBuilder(IVoidCollaboratingSpecification<THost> before)
            : base(before) {}

        public override IDeltaSpecification Specify(ISelfDescribingPredicate<THost> selfDescribingPredicate,
            Func<Exception, THost, IEvaluation<THost>> exceptionFilter = null)
        {
            return new VoidDeltaSpecification<THost>(Before,
                new VoidSpecification<THost>(Before.CollaboratingSubject,
                    Before.CollaboratingSubject.Getter,
                    exceptionFilter : exceptionFilter));
        }
    }
}
